home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Plug-In Power Pack for Netscape Communicator
/
Plug-In Power Pack for Netscape Communicator.iso
/
plugins
/
dataviews
/
dvtools
/
demos
/
dwpdemo
/
dwp_rebind.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-05-08
|
3KB
|
103 lines
#ifndef lint
static char SccsId[]= "@(#)dwp_rebind.c V1.6 3/15/95";
#endif
/*------------------------------------------------------------------
| file name -- dwp_rebind.c
|
| functions Description
| --------- -----------
| RebindData Rebinds DV-Draw variables to Application Data.
| rebind Rebinds a specific variable to application data.
| TermData Frees the Data Table.
|-----------------------------------------------------------------*/
#include "std.h"
#include "dvstd.h"
#include "dvtools.h"
#include "Tfundecl.h"
#include "dvGR.h"
#include "dwp_vars.h"
#include "dwp_data.h"
#include "VGfundecl.h"
#include "VTfundecl.h"
#include "dwp_fundecl.h"
/***************** Begin Function Declarations *************/
LOCAL ADDRESS rebind V_P_((OBJECT vd_obj, ADDRESS vdp, ADDRESS args));
/***************** End Function Declarations *************/
/*-----------------------------------------------------------------
|
| RebindData
| Traverses the view's vdps, checking to see if they need to
| be rebound to real-time data buffers.
*/
void
RebindData (view)
VIEW view;
{
/* Rebind all the vdps that match the table of real-time data.
| Get the drawing from the view and then all rebind() for
| all the variables.
*/
TobForEachVdp (TviGetDrawing (view), rebind, NULL);
}
/*-----------------------------------------------------------------
|
| rebind
| Gets the vdp's name, if it matches one in the DataTable, rebind
| the buffer to the real-time buffer.
*/
/* ARGSUSED */
LOCAL ADDRESS
rebind (vd_obj, vdp, args)
OBJECT vd_obj;
ADDRESS vdp;
ADDRESS args;
{
CHAR *varname;
SYMNODE node;
DATA_INFO *data_info;
/* Get the vdp's name */
varname = VGvdvarname (vdp);
/* See if the name is in the Table of Application Variables */
node = VTstkeyfind (DataTable, varname);
if (node)
{
/* Rebind the data to the application buffer */
data_info = (DATA_INFO *) VTsnvalue (node);
TvdPutBuffer (vdp, data_info->bufptr);
}
return NULL;
}
/*-----------------------------------------------------------------
|
| TermData
| Frees the Data Table.
*/
void TermData
V_P_ ((void))
{
CHAR *varname;
SYMNODE node;
/* Destroy the strings cloned in the table */
while (VTstlen (DataTable) > 0)
{
node = VTstsnget (DataTable, 0);
varname = VTsnkey (node);
S_FREE (varname);
VTstsnremove (DataTable, node);
}
/* Destroy the table itself */
VTstdestroy (DataTable);
}